<?php
/**
 * 基础配置文件
 *
 * 本文件包含以下配置选项：MySQL 设置、目录定义、TOP appKey和 appSecret 等基本定义
 *
 * @author		Tata <windzb@qq.com>
 *
 */


/*
 * --------------------------------------------------------------------
 * 应用所处的环境模式
 * --------------------------------------------------------------------
 *		local			本地授权模式
 *      sandbox			本地测试模式->沙箱模式
 *      run				正式模式
 *      run_url         正式模式 传递
 */

session_start();

set_time_limit(0);
date_default_timezone_set('PRC');
error_reporting(E_ALL^E_NOTICE);

header("Content-type: text/html; charset=utf-8");

if(!defined("DEV_MODE")) {
	define('DEV_MODE', 'run');
}
switch (DEV_MODE)
{
	//本地模式
	case 'local':

		define("DB_HOST","localhost");
		define("DB_USER","root");
		define("DB_PWD","");
		define("DB_NAME","hotwind_xxl");

		define("MEM_HOST","localhost");

        //测试环境
        /*define('APP_ID','wx4e432ec4e2ddd7f0');
        define('API_IP','http://10.0.17.19:8889/');*/

        //正式环境
        define('APP_ID','wx31322f6fd356ae8d');
        define('API_IP','http://10.0.19.173/');
		break;

	//线上模式
	case 'run':

		define("DB_HOST","10.0.19.127");
		define("DB_USER","outUser");
		define("DB_PWD","hotWind");
		define("DB_NAME","emoticon");

        define("MEM_HOST","10.0.19.127");
        //测试环境
        /*define('APP_ID','wx4e432ec4e2ddd7f0');
        define('API_IP','http://10.0.17.19:8889/');*/

		//正式环境
		define('APP_ID','wx31322f6fd356ae8d');
		define('API_IP','http://10.0.19.173/');

		break;


	default:
		exit('应用环境设置错误或者未设置.');
		break;
}


//==站点根目录
define('BASE_PATH', dirname(__FILE__));
//TAE不支持dirname...
//define('BASE_PATH', get_dirname(__FILE__));

//==系统文件总目录
define("SYS_PATH",BASE_PATH);

//核心文件总目录
define("CORE_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."php/core");

//通用文件总目录
define("COMMON_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."php/common");

//类库总目录
define("LIBS_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."php/libs");

//控制页面总目录
define("CTRLS_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."php/controllers");

//模型页面总目录
define("MODELS_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."php/models");

//前台视图页面总目录
define("VIEWS_FRONT_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."front/views");

//后台视图页面总目录
define("VIEWS_ADMIN_PATH",SYS_PATH. DIRECTORY_SEPARATOR ."admin/views");


/*
 * --------------------------------------------------------------------
 * 载入方法文件
 * --------------------------------------------------------------------
 *
 */

include_once( COMMON_PATH . DIRECTORY_SEPARATOR ."Function.php");


/*
 * --------------------------------------------------------------------
 * 运行Loader.php实例
 * --------------------------------------------------------------------
 *
 */
include_once( CORE_PATH . DIRECTORY_SEPARATOR ."Loader.php" );


/*
* --------------------------------------------------------------------
* 载入主控制器
* --------------------------------------------------------------------
*
*/
require_once CORE_PATH.'/Controller.php';
function &get_instance()
{
	return Controller::get_instance();
}
$TATA = new Controller();



/*
 * --------------------------------------------------------------------
 * 载入数据库db.php类
 * --------------------------------------------------------------------
 *
 */
include_once( LIBS_PATH . "/DB.php");

/*
 * --------------------------------------------------------------------
 * 载入主模型
 * --------------------------------------------------------------------
 *
 */
require_once CORE_PATH.'/Model.php';

